/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sampleEntity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ASUS K43E
 */
@Entity
@Table(name = "Bill", catalog = "Lafitte", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Bill.findAll", query = "SELECT b FROM Bill b"),
    @NamedQuery(name = "Bill.findByBillId", query = "SELECT b FROM Bill b WHERE b.billId = :billId"),
    @NamedQuery(name = "Bill.findByRoomPrice", query = "SELECT b FROM Bill b WHERE b.roomPrice = :roomPrice"),
    @NamedQuery(name = "Bill.findByPayment", query = "SELECT b FROM Bill b WHERE b.payment = :payment"),
    @NamedQuery(name = "Bill.findByBDate", query = "SELECT b FROM Bill b WHERE b.bDate = :bDate"),
    @NamedQuery(name = "Bill.findByPoint", query = "SELECT b FROM Bill b WHERE b.point = :point")})
public class Bill implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @Column(name = "billId", nullable = false)
    private Integer billId;
    @Column(name = "roomPrice", precision = 15)
    private Double roomPrice;
    @Basic(optional = false)
    @Column(name = "payment", nullable = false)
    private double payment;
    @Basic(optional = false)
    @Column(name = "bDate", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date bDate;
    @Basic(optional = false)
    @Column(name = "point", nullable = false)
    private int point;
    @JoinColumn(name = "roomId", referencedColumnName = "roomId")
    @ManyToOne
    private Room room;
    @JoinColumn(name = "username", referencedColumnName = "username", nullable = false)
    @ManyToOne(optional = false)
    private Customers customers;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bill")
    private Collection<BillDetail> billDetailCollection;

    public Bill() {
    }

    public Bill(Integer billId) {
        this.billId = billId;
    }

    public Bill(double roomPrice, double payment, Date bDate, int point, Customers customers) {
        this.roomPrice = roomPrice;
        this.payment = payment;
        this.bDate = bDate;
        this.point = point;
        this.customers = customers;
    }

    public Bill(double roomPrice, double payment, Date bDate, int point, Room room, Customers customers) {
        this.roomPrice = roomPrice;
        this.payment = payment;
        this.bDate = bDate;
        this.point = point;
        this.room = room;
        this.customers = customers;
    }

    public Bill(Integer billId, double payment, Date bDate, int point) {
        this.billId = billId;
        this.payment = payment;
        this.bDate = bDate;
        this.point = point;
    }

    public Integer getBillId() {
        return billId;
    }

    public void setBillId(Integer billId) {
        this.billId = billId;
    }

    public Double getRoomPrice() {
        return roomPrice;
    }

    public void setRoomPrice(Double roomPrice) {
        this.roomPrice = roomPrice;
    }

    public double getPayment() {
        return payment;
    }

    public void setPayment(double payment) {
        this.payment = payment;
    }

    public Date getBDate() {
        return bDate;
    }

    public void setBDate(Date bDate) {
        this.bDate = bDate;
    }

    public int getPoint() {
        return point;
    }

    public void setPoint(int point) {
        this.point = point;
    }

    public Room getRoom() {
        return room;
    }

    public void setRoom(Room room) {
        this.room = room;
    }

    public Customers getCustomers() {
        return customers;
    }

    public void setCustomers(Customers customers) {
        this.customers = customers;
    }

    public Collection<BillDetail> getBillDetailCollection() {
        return billDetailCollection;
    }

    public void setBillDetailCollection(Collection<BillDetail> billDetailCollection) {
        this.billDetailCollection = billDetailCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (billId != null ? billId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bill)) {
            return false;
        }
        Bill other = (Bill) object;
        if ((this.billId == null && other.billId != null) || (this.billId != null && !this.billId.equals(other.billId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sampleEntity.Bill[billId=" + billId + "]";
    }

}
